package com.send.sms.controller;

import com.send.sms.pojo.vo.ToCheckLogin;
import com.send.sms.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description 用户接口
 * @Author 小乌龟
 * @Date 2022/9/14 9:45
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    /**
      *发送短信
      * @param phone 电话号码
      * @return String
      * @author zhangjunrong
      * @date 2022/9/14 20:04
      */
    @GetMapping("/send")
    public String toSendMessage(@RequestParam("phone") String phone){
        return userService.toSendMessage(phone);
    }

    @PostMapping("/checkLogin")
    public String checkLogin(@RequestBody ToCheckLogin toCheckLogin){
        return userService.checkLogin(toCheckLogin.getPhoneNumber(),toCheckLogin.getCode());
    }
}
